bitkeeper revision 1.1236.1.177 (424c6d618owgwMOuAqt8Gn8X7pnDCw)
authoriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>
Thu, 31 Mar 2005 21:36:33 +0000 (21:36 +0000)
committeriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>
Thu, 31 Mar 2005 21:36:33 +0000 (21:36 +0000)
Merge

1  2 
xen/common/dom0_ops.c

index 6ce1abe6335f413f7e8488b09be8d5022733d430,3af35e39e09ebfa62df563bffe0025430297cdb7..0c6bb484e0b6e28d1784f53bbbad7d7c474104e9
@@@ -179,19 -178,22 +179,25 @@@ long do_dom0_op(dom0_op_t *u_dom0_op
          {
              /* Do an initial placement. Pick the least-populated CPU. */
              struct domain *d;
-             unsigned int i, cnt[NR_CPUS] = { 0 };
 +            struct exec_domain *ed;
+             unsigned int i, ht, cnt[NR_CPUS] = { 0 };
  
              read_lock(&domlist_lock);
 -            for_each_domain ( d )
 -                cnt[d->processor]++;
 +            for_each_domain ( d ) {
 +                for_each_exec_domain ( d, ed )
 +                    cnt[ed->processor]++;
 +            }
              read_unlock(&domlist_lock);
  
-             for ( i = 0; i < smp_num_cpus; i++ )
-                 if ( cnt[i] < cnt[pro] )
-                     pro = i;
+             /* If we're on a HT system, we only use the first HT for dom0,
+                other domains will all share the second HT of each CPU.
+              Since dom0 is on CPU 0, we favour high numbered CPUs in
+              the event of a tie */
+             ht = opt_noht ? 1 : ht_per_core;
+             pro = ht-1;
+             for ( i = pro; i < smp_num_cpus; i += ht )
+               if ( cnt[i] <= cnt[pro] )
+                   pro = i;
          }
          else
              pro = op->u.createdomain.cpu % smp_num_cpus;